function G=def_draw_game_finish(G)
% def_draw_game_finish: Default subroutine to be called when the whole simulation is done
%
% SYNTAX:
%   G= def_draw_game_finish(G)
%   Do some work after simulating the whole game and return the game object so as to allow users change the game object.
%   This routine will clear temopory graphics objects generated in simulation 
%   and plot curves of all player states in the data plotting window.
%   Will be called after the simulation loop is done.
%   You can provide your own routine following the calling syntax here.

%   Author: Hongbin Ma
%   Last updated: 2009-6-1 with MATLAB 6.5
%   Problems or suggestions? Email me: mathmhb[at]163.com

if G.draw>0,
  figure(G.figure);
  hh=G.objs_clear;
  for k=1:G.N+1;
      for h=hh{k},
          set(h,'Visible','off');
      end;
  end;
end;
if G.draw<2,
  return;
end;
figure(G.figure2);
clf;
for k=1:G.N,
  h=plot(G.TData,G.P{k}.VarsData,G.P{k}.legend);
end;
title('history of  states vs. time');
winontop(G.figure,0);
winontop(G.figure2,0);
